﻿using MediatR;
using SheepStorage.API.Application.Command.BuildingManagementCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.DataImp;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.BuildingManagementCommandHandler
{
    public class BuildingManagementDelCommandHandler : IRequestHandler<BuildingManagementDelCommand, Results<int>>
    {
        private readonly IBuildingManagementService buildingManagementService;

        public BuildingManagementDelCommandHandler(IBuildingManagementService buildingManagementService)
        {
            this.buildingManagementService = buildingManagementService;
        }
       

        public async Task<Results<int>> Handle(BuildingManagementDelCommand request, CancellationToken cancellationToken)
        {
            var list = buildingManagementService.DelBuildingManagement(request.BuildingManagementId);
            return Results<int>.DataResult(list);
        }
    }
}
